<?php
namespace app\warehouse\controller;

use think\Db; 
class Query extends Base{

	public function index(){
        //echo "index";
        return view('index');
    }
	public function search(){
        $key = input("post.key");
        $list = Db::table('warehouse_item')
                ->where('name|note','like','%'.$key.'%')
                ->select();
        //var_dump($list);
        //$map[]
        //$list = $wi->search($key);

        
        foreach ($list as $key => $value) {
            $list[$key]['category'] = $this->api_get_category_name($value['cid']);
        }
        $this->assign('list',$list);
        return view('search');
    }
}